<?php

namespace Tasks;

use Doctrine\Common\Cli\Tasks\AbstractTask,
    Doctrine\Common\Cli\CliException,
    Doctrine\Common\Cli\Option,
    Doctrine\Common\Cli\OptionGroup;

class MakeFoldersTask extends AbstractTask
{

    public function buildDocumentation()
    {
        $doc = $this->getDocumentation();
        $doc->setName('MakeFolders')
            ->setDescription('Executes making folders needed by doctrine from the command line.');
    }

    public function run() 
    {
        $folderListArray = array('fixtures', 'migrations', 'sql', 'schema', 'models/Entities', 'proxies');
        foreach ($folderListArray as $folderName) {
            if(!mkdir(APPPATH.$folderName, 0755, false))
            {
                echo 'Failed to create folder! : ' . APPPATH.$folderName;
            } else {
                echo 'Success to create folder! : ' . APPPATH.$folderName;
            }
        }
    }

}